home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6723 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1009 b 

  1. Path: nwlink.com!usenet
  2. From: jlim@nwlink.com (John Lim)
  3. Newsgroups: comp.lang.c
  4. Subject: Pointers to Linked Lists
  5. Date: Sun, 11 Feb 1996 04:45:14 GMT
  6. Organization: Northwest Link
  7. Message-ID: <4fjs0b$7sb@texas.nwlink.com>
  8. NNTP-Posting-Host: port19.annex2.nwlink.com
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. please help me with this pointer question
  12.  
  13.  
  14. typedef struct node
  15. {
  16.    generic_ptr    data;        (generic_ptr is a pointer to void)
  17.    struct node    *next;
  18. } node, *list;
  19.  
  20. so i know that list is a pointer to a node
  21.  
  22. in main i have the lines
  23.  
  24. list    pairlist;
  25.  
  26. adtInitializeList (&pair_list)        (adtInitializeList is a library
  27.                      function which i have to write)
  28.  
  29. in libadt.c
  30.  
  31. adtInitializeList (list *pL)
  32. {
  33.    *pL=NULL;
  34.    return OK:
  35. }
  36.  
  37. so my questions are:
  38. - isn't pL a pointer to a pointer to a node? because it is of type
  39. list and list is a pointer to a node
  40. -if so why would one need to use this?  why can't you just use 
  41. adtInitializeList (list pL)?
  42.  
  43. any help would be appreciated
  44. john lim (jlim@nwlink.com)
  45.  
  46.